package sq.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import sq.sms.SmsVlidator;
import sq.vo.BaseRespVO;

/**
 * @author sunquan
 */
@RestController
public class NoteController {
    @Autowired
    private SmsVlidator smsVlidator;

    /**
     * 短信验证码发送接口实现
     *
     * @param phone 开发者手机号
     */
    @PostMapping(value = "/sms_transmission")
    public BaseRespVO noteValidate(@RequestParam String phone) {
        String flag=smsVlidator.sendValidation(phone);
        BaseRespVO baseRespVO=new BaseRespVO();
        if (flag!=null){
            baseRespVO.setCode("0");
            baseRespVO.setMsg("success");
        }else {
            baseRespVO.setCode("1");
            baseRespVO.setMsg("lose");
        }
        return baseRespVO;
    }
}
